package com.ljl.Mapper;


import com.ljl.Entity.Custom;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface CustomListMapper {

    //TODO 增加客户信息
    @Insert("INSERT INTO customlist (name, company, role, birthday, gender, tel, imgurl, jlurl) values (#{name}, #{company}, #{role}, #{birthday}, #{gender}, #{tel}, #{imgurl}, #{jlurl})")
    int insertCustom(Custom custom);

    //TODO 查询客户信息-全部
    @Select("SELECT * FROM customlist")
    List<Custom> getAllCustomList();

    //TODO 查询订单信息-根据客户名称模糊查询
    @Select("SELECT * FROM customlist WHERE name LIKE CONCAT('%', #{name}, '%')")
    List<Custom> getOrderListByLikeCustomName(String name);

    //TODO 查询订单信息-根据客户名称详细查询
    @Select("SELECT * FROM customlist WHERE name = #{name}")
    List<Custom> getOrderListByCustomName(String name);


    //TODO 删除客户信息-根据顾客id
    @Delete("DELETE FROM customlist WHERE id = #{id}")
    int deleteCustomerById(int id);

    //TODO 更新顾客信息-根据顾客name
    @Update("UPDATE customlist SET company = #{company}, role = #{role}, birthday = #{birthday}, gender = #{gender}, tel = #{tel} WHERE name = #{name}")
    int updateCustomerInfo(Custom custom);


}
